package com.cjr.controller;

import com.cjr.dao.ResumeDao;
import com.cjr.pojo.Resume;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: chenjianrong
 * @Description:
 * @Data: Create in 15:26 2020/2/1
 * @Modified By:
 */
@RestController
@RequestMapping("/resume")
public class ResumeController {

    @Autowired
    private ResumeDao resumeDao;

    /**
     * 查询单个
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Resume findOne(@PathVariable("id") Long id) {
        return resumeDao.findOne(id);
    }

    /**
     * 查询全部
     * @return
     */
    @GetMapping()
    public List<Resume> findAll() {
        return resumeDao.findAll();
    }

    /**
     * 新增和修改
     * @param resume
     */
    @PostMapping()
    public void save(Resume resume) {
        resumeDao.save(resume);
    }


    /**
     * 删除
     * @param id
     */
    @DeleteMapping("/{id}")
    public void deleteById(@PathVariable Long id) {
        resumeDao.delete(id);
    }

}
